package javaee.DAO;

import javaee.entity.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Repository;

@Repository("userDao")
public class UserDaoImpl implements UserDao {
    @Override
    public boolean login(String name, String password) {
        if (name.equals("张三")&&password.equals("123")){
            return true;
        }
        return false;
    }
    @Override
    public void save() {
        ApplicationContext applicationContext=new ClassPathXmlApplicationContext("applicationContext-4.xml");
        User user=(User) applicationContext.getBean("user");
        System.out.println(user);
        System.out.println("执行UserDaoImpl.save()");
    }

    @Override
    public void addUser() {
        System.out.println("添加用户");

    }

    @Override
    public void deleteUser() {
        System.out.println("删除用户");

    }

    public void insert() {
        System.out.println("添加用户信息");
    }
    public void delete() {
        System.out.println("删除用户信息");
    }
    public void update() {
        System.out.println("更新用户信息");
    }
    public void select() {
        System.out.println("查询用户信息");
    }
}
